home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / CCDBMS.ZIP / THREAD.CPP < prev    next >
C/C++ Source or Header  |  1997-03-17  |  4KB  |  101 lines

  1. // =================================================================
  2. // Thread.cpp
  3. // =================================================================
  4. // Harold Kasperink / John Dekker 
  5. // Dr. Dobb's Journal 1997
  6. // =================================================================
  7. // The function bodies in this files are empty because we cannot 
  8. // give the thread class implementation for copyright reasons  and
  9. // because it is beyond the scope of our article.
  10. // What you could do is write here your own Pthread wrapper
  11. // implememtation.
  12. // =================================================================
  13. #include <stdio.h>
  14. #include <stdlib.h> 
  15. #include <string.h>
  16. #include <iostream.h>
  17.  
  18. #include "thread.h"
  19.  
  20. static  int m_nThread = 0;
  21.  
  22. ////////////////////////////////////////////////////////////////////
  23. // ThreadFunc
  24. ////////////////////////////////////////////////////////////////////
  25. // pThread     = pointer to thread class which created the thread
  26. //
  27. // When a thread is created, the pointer to this function is passed
  28. // as an argument, meaning that the trhead will jump to this function.
  29. // The virtual class function Process is then called immediately
  30. ////////////////////////////////////////////////////////////////////
  31. void ThreadFunc(CThread *pThread)
  32. {
  33. }
  34.  
  35. ////////////////////////////////////////////////////////////////////
  36. // CThread::CThread
  37. ////////////////////////////////////////////////////////////////////
  38. // Constructor for thread
  39. ////////////////////////////////////////////////////////////////////
  40. CThread::CThread()
  41. {
  42. }
  43.  
  44. ////////////////////////////////////////////////////////////////////
  45. // CThread::~CThread
  46. ////////////////////////////////////////////////////////////////////
  47. // Destructor for thread object
  48. ////////////////////////////////////////////////////////////////////
  49. CThread::~CThread()
  50. {
  51. }
  52.  
  53. ////////////////////////////////////////////////////////////////////
  54. // CThread::Process
  55. ////////////////////////////////////////////////////////////////////
  56. // Dummy Function for creating the process thread loop in the 
  57. // derived class
  58. ////////////////////////////////////////////////////////////////////
  59. void CThread::Process()
  60. {
  61. }
  62.  
  63. ////////////////////////////////////////////////////////////////////
  64. // CThread::Cancel
  65. ////////////////////////////////////////////////////////////////////
  66. // Stop the thread created in this object
  67. ////////////////////////////////////////////////////////////////////
  68. void CThread::Cancel()
  69. {
  70. }
  71.  
  72. ////////////////////////////////////////////////////////////////////
  73. // CThread::Create
  74. ////////////////////////////////////////////////////////////////////
  75. // Create a thread, which will jumps to the pure virtal function 
  76. // Process of the derived class
  77. ////////////////////////////////////////////////////////////////////
  78. void CThread::Create()
  79. {
  80. }
  81.  
  82. ////////////////////////////////////////////////////////////////////
  83. // CThread::Detach
  84. ////////////////////////////////////////////////////////////////////
  85. // Frees the thread memory
  86. ////////////////////////////////////////////////////////////////////
  87. void CThread::Detach()
  88. {
  89. }
  90.  
  91. ////////////////////////////////////////////////////////////////////
  92. // CThread::Join
  93. ////////////////////////////////////////////////////////////////////
  94. // Let the main loop wait until the thread finishes
  95. ////////////////////////////////////////////////////////////////////
  96. void CThread::Join()
  97. {
  98. }
  99.  
  100.  
  101.